from dolfin import *

mesh = Mesh()
editor = MeshEditor()
editor.open(mesh,1,2)
editor.init_vertices(4)
editor.init_cells(4)

editor.add_vertex(0,0,0)
editor.add_vertex(1,1,0)
editor.add_vertex(2,1,1)
editor.add_vertex(3,0,1)

editor.add_cell(0,0,1)
editor.add_cell(1,1,2)
editor.add_cell(2,2,3)
editor.add_cell(3,3,0)

editor.close()

mesh.order()
V=FunctionSpace(mesh,'CG',1)
print assemble(Constant(1.0,cell=V.ufl_element().cell())*dx,mesh=mesh)

